﻿<%@ Page Title="" Language="C#" MasterPageFile="~/BaseInfoMaster.master" AutoEventWireup="true"
    CodeFile="TableView.aspx.cs" Inherits="Business_TableView" %>

<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxTabControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2.Linq, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Data.Linq" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link type="text/css" rel="stylesheet" href="../Content/Site.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
        function ShowConsumer(control) {

            PPanel.ShowAtElement(control);
        }
        function CbConsumer(id) {
            ConsumerPanel.PerformCallback(id);
        }
    </script>
    <dx:ASPxPopupControl ID="ASPxPopupControl1" runat="server" ClientInstanceName="PPanel"
        Width="450px" AllowResize="true" HeaderText="客户信息" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
        CssPostfix="DevEx" EnableHotTrack="False" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
        <LoadingPanelImage Url="~/App_Themes/DevEx/Web/Loading.gif">
        </LoadingPanelImage>
        <LoadingPanelStyle ImageSpacing="5px">
        </LoadingPanelStyle>
        <ContentCollection>
            <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                <dx:ASPxCallbackPanel ID="ConsumerPanel" ClientInstanceName="ConsumerPanel" runat="server"
                    Width="200px" OnCallback="ConsumerPanel_Callback">
                    <PanelCollection>
                        <dx:PanelContent>
                            <div runat="server" id="BookDetail">
                            </div>
                        </dx:PanelContent>
                    </PanelCollection>
                </dx:ASPxCallbackPanel>
            </dx:PopupControlContentControl>
        </ContentCollection>
    </dx:ASPxPopupControl>
    <h1 class="DemoTitle">
        餐位管理
    </h1>
    <div id="DemoArea">
        <div class="Spacer">
        </div>
        <dx:ASPxCallbackPanel ID="QueryCBPanel" ClientInstanceName="QueryPanel" runat="server"
            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" OnCallback="QueryCBPanel_Callback">
            <ClientSideEvents EndCallback="function(s,e){if(lblJSmsg.GetText()!=''){alert(lblJSmsg.GetText());if(lblJSWin.GetText()!=null){windows.herf=lblJSWin.GetText();}}}" />
            <LoadingPanelImage Url="~/App_Themes/DevEx/Web/Loading.gif">
            </LoadingPanelImage>
            <LoadingPanelStyle ImageSpacing="5px">
            </LoadingPanelStyle>
            <PanelCollection>
                <dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
                    <dx:ASPxLabel ID="lblJSmsg" ClientInstanceName="lblJSmsg" runat="server" Text="" ClientVisible="false">
                    </dx:ASPxLabel>
                    <dx:ASPxLabel ID="lblJSWin" ClientInstanceName="lblJSWin" runat="server" Text="" ClientVisible="false">
                    </dx:ASPxLabel>
                    <dx:ASPxPanel ID="ASPxPanel1" ClientInstanceName="ContainerPanel" runat="server"
                        Width="100%">
                        <PanelCollection>
                            <dx:PanelContent>
                                <table>
                                    <tr>
                                        <td colspan="5" style="white-space: nowrap">
                                            当前<asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            日期：
                                        </td>
                                        <td>
                                            <dx:ASPxDateEdit ID="Query_BeginT" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                                CssPostfix="DevEx" EnableAnimation="False" Font-Size="10pt" Spacing="0" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                                <CalendarProperties ShowClearButton="false" ClearButtonText="清除" TodayButtonText="今天">
                                                    <HeaderStyle Spacing="1px" />
                                                </CalendarProperties>
                                                <ButtonStyle Width="13px">
                                                </ButtonStyle>
                                            </dx:ASPxDateEdit>
                                        </td>
                                        <td>
                                            时段：
                                        </td>
                                        <td>
                                            <dx:ASPxComboBox ID="Query_Period" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                                CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                                ValueType="System.String" Width="170px">
                                            </dx:ASPxComboBox>
                                        </td>
                                        <td align="center">
                                            <dx:ASPxButton ID="btnQuery" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                                CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                                Text="查询" AutoPostBack="False" UseSubmitBehavior="False">
                                                <ClientSideEvents Click="function(s,e){QueryPanel.PerformCallback('btnQuery');ContainerPanel.ClientEnable=false; }" />
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                                <table>
                                    <tr>
                                        <td>
                                            <dx:ASPxButton ID="btnChange" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                                CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                                Text="转台" AutoPostBack="False" UseSubmitBehavior="False">
                                                <ClientSideEvents Click="function(s,e){QueryPanel.PerformCallback('btnChange');ContainerPanel.ClientEnable=false; msg='转台成功！'; }" />
                                            </dx:ASPxButton>
                                        </td>
                                        <td>
                                            <dx:ASPxButton ID="btnNew" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                                CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                                Text="按选中桌台新增预定" AutoPostBack="False" OnClick="btnNew_Click">
                                                <ClientSideEvents Click="function(s,e){QueryPanel.PerformCallback('btnNew');ContainerPanel.ClientEnable=false; }" />
                                            </dx:ASPxButton>
                                        </td>
                                        <td>
                                            追加到已有预定
                                        </td>
                                        <td>
                                            <dx:ASPxComboBox ID="Query_Bookno"  runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                                CssPostfix="DevEx" Font-Size="10pt" EnableAnimation="false" DisplayFormatString="{0}" ValueField="BookNo" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                                ValueType="System.String" Width="170px">

                                                <Columns >
                                                <dx:ListBoxColumn  Caption="订金单号" FieldName="BookNo"  />
                                                <dx:ListBoxColumn Caption="联系人" FieldName="ContractName" />
                                                <dx:ListBoxColumn Caption="联系电话" FieldName="ContractPhoneNum"  />
                                                <dx:ListBoxColumn Caption="添加时间" FieldName="AddTime"  />
                                                </Columns>
                                            </dx:ASPxComboBox>
                                        </td>
                                        <td>
                                            <dx:ASPxButton ID="btnAdd" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                                CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                                                Text="追加" AutoPostBack="False" OnClick="btnAdd_Click">
                                                <ClientSideEvents Click="function(s,e){QueryPanel.PerformCallback('btnAdd');ContainerPanel.ClientEnable=false; }" />
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                                <dx:ASPxTabControl ID="TabArea" Font-Size="10pt" runat="server" Width="100%" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                    CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                    <Paddings Padding="2px" PaddingLeft="5px" PaddingRight="5px" />
                                    <ContentStyle>
                                        <Border BorderColor="#9DA0AA" BorderStyle="Solid" BorderWidth="1px" />
                                    </ContentStyle>
                                </dx:ASPxTabControl>
                                <dx:ASPxGridView ID="gridView" runat="server" AutoGenerateColumns="False" KeyFieldName="TableID"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" ClientInstanceName="grid" CssPostfix="DevEx"
                                    Width="100%" OnCustomCallback="gridView_CustomCallback">
                                    <Settings ShowFilterRow="true" ShowPreview="true" />
                                    <SettingsPager Position="TopAndBottom" >
                                    </SettingsPager>
                                    <Columns>
                                        <dx:GridViewCommandColumn Name="cmd" ShowSelectCheckbox="true" VisibleIndex="0">
                                        </dx:GridViewCommandColumn>
                                        <dx:GridViewDataTextColumn Name="t_TableID" FieldName="TableID" VisibleIndex="0"
                                            CellStyle-HorizontalAlign="Left" Caption="餐桌序号">
                                            <CellStyle HorizontalAlign="Left">
                                            </CellStyle>
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Name="t_TableName" FieldName="TableName" VisibleIndex="1"
                                            CellStyle-HorizontalAlign="Left" Caption="餐桌名称">
                                            <CellStyle HorizontalAlign="Left">
                                            </CellStyle>
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Name="t_PCount" FieldName="PCount" VisibleIndex="2" CellStyle-HorizontalAlign="Right"
                                            Caption="人数">
                                            <EditFormSettings CaptionLocation="Near"></EditFormSettings>
                                            <CellStyle HorizontalAlign="Right">
                                            </CellStyle>
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn Name="t_TableID" FieldName="TableID" VisibleIndex="4"
                                            CellStyle-HorizontalAlign="Left" Caption="预定管理">
                                           <Settings AllowAutoFilter="False" />
                                            <DataItemTemplate> 
                                                
                                                <%#
                                               (Eval("State") != null && !(Eval("State").ToString() == "-1")) ?
                                                                                              "<a href=\"javascript:CbConsumer('" + Eval("BookNo") + "|" + Eval("DetailRemark") + "');\" onclick='javascript:ShowConsumer(this)'>预定信息</a>" : string.Empty
                                                %>
                                                <%#
                                                (Eval("State") != null && !(Eval("State").ToString() == "-1")) ?
                                                       string.Format("<a href=\"EditBook.aspx?action=update&BookNo={0}\">预定管理</a>",Eval("BookNo")) : string.Empty
                                                %>
                                            </DataItemTemplate>
                                            <CellStyle HorizontalAlign="Left">
                                            </CellStyle>
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataComboBoxColumn Name="t_State" FieldName="State" VisibleIndex="3"
                                            CellStyle-HorizontalAlign="Right" Caption="状态">
                                            <PropertiesComboBox ValueType="System.String" Spacing="0">
                                                <Items>
                                                    <dx:ListEditItem Text="预定" Value="1" />
                                                    <dx:ListEditItem Text="非确定预定" Value="2" />
                                                    <dx:ListEditItem Text="到店" Value="3" />
                                                    <dx:ListEditItem Text="结账" Value="4" />
                                                    <dx:ListEditItem Text="空桌" Value="-1" />
                                                </Items>
                                            </PropertiesComboBox>
                                            <EditFormSettings CaptionLocation="Near"></EditFormSettings>
                                            <CellStyle HorizontalAlign="Right">
                                            </CellStyle>
                                        </dx:GridViewDataComboBoxColumn>
                                        <dx:GridViewCommandColumn Visible="true" Caption="#">
                                            <ClearFilterButton Visible="true">
                                            </ClearFilterButton>
                                        </dx:GridViewCommandColumn>
                                    </Columns>
                                    <Templates>
                                        <PreviewRow>
                                            餐台信息备注：<%# Eval("Remark") %>
                                        </PreviewRow>
                                    </Templates>
                                    <Images SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                        <LoadingPanelOnStatusBar Url="~/App_Themes/DevEx/GridView/StatusBarLoading.gif">
                                        </LoadingPanelOnStatusBar>
                                        <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                                        </LoadingPanel>
                                    </Images>
                                    <ImagesFilterControl>
                                        <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                                        </LoadingPanel>
                                    </ImagesFilterControl>
                                    <Styles CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx">
                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                        </Header>
                                        <LoadingPanel ImageSpacing="5px">
                                        </LoadingPanel>
                                    </Styles>
                                    <StylesEditors ButtonEditCellSpacing="0">
                                        <ProgressBar Height="21px">
                                        </ProgressBar>
                                    </StylesEditors>
                                </dx:ASPxGridView>
                            </dx:PanelContent>
                        </PanelCollection>
                    </dx:ASPxPanel>
                </dx:PanelContent>
            </PanelCollection>
        </dx:ASPxCallbackPanel>
    </div>
</asp:Content>
